<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css"
	href="${rootPath }/Styles/admin-all.css" />
<link rel="stylesheet" type="text/css"
	href="${rootPath }/Styles/base.css" />
<script type="text/javascript"
	src="${rootPath }/Scripts/jquery-1.7.2.js"></script>
<script type="text/javascript"
	src="${rootPath }/Scripts/jquery-ui-1.8.22.custom.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${rootPath }/Styles/ui-lightness/jquery-ui-1.8.22.custom.css" />
<link rel="stylesheet" type="text/css"
	href="${rootPath }/Styles/formui.css" />
<script type="text/javascript" src="${rootPath }/Scripts/tb.js"></script>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet"
		href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
		integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
		crossorigin="anonymous">
		<link rel="stylesheet" type="text/css" href="../Styles/bt.css" />
		<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
		<script
			src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
			<script type="text/javascript">

		/* 	/* 分页提交表单 
			currentPageId:currentPage文本框的id
			currentPage:当前页的值
			pageSizeId:pageSize文本框的id
			pageSize:每页多少条的值
		*/ 
		function pageForm(currentPageId,currentPage,pageSizeId,pageSize)
		{
			/* 获取当前页和每页多少条文本框的值 */
			/*$("#currentPage").val()*/
			/* 修改这个值 */
			/* $("#currentPage").val(23); */
			$("#" + currentPageId).val(currentPage);
			$("#" + pageSizeId).val(pageSize);
			
			/* jquery提交表单 */
			$("#usersListPageForm").submit(); 
			
			/*
			标签的默认行为:如果返回true就执行,如果返回false就不执行
			a链接 默认行为是打开href里面的内容,a链接的默认行为就不执行
			*/
			return false ; 
		}

</script>
</head>
<body>

	<div class="alert alert-info">
		当前位置<b class="tip"></b>用户查询
	</div>
	<div class="search">
		<div class="sel">
			<form action="${rootPath}/usermanage/searchUser.html" method="post"
				class="form-inline">
				<div class="">
					<div class="form-group">
						<label for="user">邮箱</label> <input type="text" name="email"
							id="email" value="${requestScope.email }" class="form-control"
							placeholder="邮箱" />
					</div>

					<div class="form-group">
						<label for="user">地址</label> <input type="text" name="address"
							id="address" value="${requestScope.address }"
							class="form-control" placeholder="地址" />
					</div>
					<label for="job">状态</label> <select class="form-control"
						id="status">
						<option value="1"${requestScope.status=='1' ? 'selected' : '' }">启用</option>
						<option value="0"${requestScope.status=='1' ? 'selected' : '' }">禁用</option>
					</select>
					<div class="form-group">
						<label for="user">姓名</label> <input type="text" name="name"
							id="name" value="${requestScope.name }" class="form-control"
							placeholder="姓名" />
					</div>
					<div class="form-group">
						<label for="user">身份证</label> <input type="text" name="identity"
							id="identity" value="${requestScope.identity }"
							class="form-control" placeholder="身份证" />
					</div>

					<button type="submit" class="btn btn-success">查询</button>
				</div>
				</form>
				<div class="table">
					<table class="table">
						<thead>
							<tr>
								<th>序号</th>
								<th>身份证</th>
								<th>姓名</th>
								<th>性别</th>
								<th>电话</th>
								<th>邮箱</th>
								<th>地址</th>
								<th>删除</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${requestScope.users }" var="users"
								varStatus="stat">


								<tr class="active">
									<td>${stat.count }</td>
									<td>${users.identity}</td>
									<td>${users.name }</td>
									<td>${users.sexstr}</td>
									<td>${users.phone }</td>
									<td>
										<%-- ${admins.email} --%> <%--
												~先获取到@下标值
												~截取从0到@-3的字符串
												~加***
												~截取从@到结尾的字符串
												~字符串相加
												给邮箱加密
												    ${fn:indexOf(admins.email,"@")}
								 --%> <c:set var="index"
											value="${fn:indexOf(admins.email, '@')}" /> <c:set
											var="totalLength" value="${fn:length(admins.email)}" />
										${fn:substring(admins.email,0,index-3)}***
										${fn:substring(admins.email,index,totalLength) }

									</td>

									<td>${users.address }</td>
									<td><input type="button" name="sc" id="sc" value="删除" /></td>
								</tr>
							</c:forEach>

						</tbody>

					</table>
					<form id="usersListPageForm"
						action="${rootPath}/usermanage/searchUser.html" method="post">

						<%--带上搜索条件 --%>
						<input type="hidden" name="email" value="${requestScope.email }">
							<input type="hidden" name="address"
							value="${requestScope.address }"> <input type="hidden"
								name="status" value="${requestScope.status }"> <input
									type="hidden" name="name" value="${requestScope.name }">
										<input type="hidden" name="identity"
										value="${requestScope.identity }">
						<nav>
						<ul class="pager">
							<li><a href=""
								onclick="return pageForm('currentPage','1','pageSize',${requestScope.pageInfoUtil.pageSize});"><span>首页</span></a></li>
							<li><a href=""
								onclick="return pageForm('currentPage','${requestScope.pageInfoUtil.prePage}','pageSize','${requestScope.pageInfoUtil.pageSize}');"><span>上一页</span></a></li>
							<li><a href=""
								onclick="return pageForm('currentPage','${requestScope.pageInfoUtil.nextPage}','pageSize','${requestScope.pageInfoUtil.pageSize}');"><span>下一页</span></a></li>
							<li><a href=""
								onclick="return pageForm('currentPage','${requestScope.pageInfoUtil.totalPage}','pageSize','${requestScope.pageInfoUtil.pageSize}');"><span>尾页</span></a></li>
							<li>共${pageInfoUtil.totalRecord}条</li>
							<li>共${pageInfoUtil.totalPage}页</li>
							<li>第 <input type="text" id="currentPage" name="currentPage"
								value="${pageInfoUtil.currentPage}" size="5" maxlength="5" /> 页
							</li>
							<li>每页<input type="text" id="pageSize" name="pageSize"
								value="${requestScope.pageInfoUtil.pageSize}" size="5"
								maxlength="5" /> 条
							</li>
							<li><input type="submit" value="GO" class="btn btn-primary" /></li>
						</ul>
						</nav>
					</form>
				</div>
		</div>
	</div>
</body>
</html>
